package javaClassExercise.referencesSort;

import org.junit.Test;

/**
 * Created by lomo on 2017/3/18.
 */
public class referenceTypeSort {



    @Test
    public void test() {
        User user = new User("lomo", "male", 25);
        System.out.println(user.getName() + " Is " +user.getGender()); //lomo Is male
    }


}


//User 类
class User {
    private String name;
    private String gender;
    private int age;


    //cmd+n 生成带参的构造函数, new时必须给参数, new完后就可以使用获得对应属性
    public User(String name, String gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    public void setName() {
        this.name = name;
    }

    public String getName() {
        return name;
    }


    public void setGender() {
        this.gender = gender;
    }

    public String getGender() {
        return gender;
    }


    public void setAge() {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

}


